<?php
	function render($content) {
		echo "<div class='single_content'>";
		switch ($content['tipe']) {
			case 'Gambar':
				echo renderImage($content);
				break;
			case 'Link':
				echo renderLink($content);
				break;
			case 'Video':
				echo renderVideo($content);
				break;
		}
		echo "</div>";
	}
	
	function renderImage($content) {
		$selisih = $content['waktu']['selisih'];
		$satuan = $content['waktu']['satuan'];
		return "<div id='posterkonten'><img src='${content['URL']}' /></div>
			<div id='desckonten'>
				<a href='konten.php?ID=${content['ID_konten']}'><strong>${content['judul']}</strong></a>
				<p>Dipost oleh <a href='profil.php?id=${content['ID_user']}'>${content['username']}</a> $selisih $satuan yang lalu<br />
					Views: ${content['views']}<br />
					Comments: ${content['comments']}
				</p>
				
			</div>";
	}
	
	function renderVideo($content) {
		$selisih = $content['waktu']['selisih'];
		$satuan = $content['waktu']['satuan'];
		return "<div id='posterkonten'><iframe width='130' height='100' src='${content['URL']}' frameborder='0' allowfullscreen></iframe></div>
			<div id='desckonten'>
				<a href='konten.php?ID=${content['ID_konten']}'><strong>${content['judul']}</strong></a>
				<p>Dipost oleh <a href='profil.php?id=${content['ID_user']}'>${content['username']}</a> $selisih $satuan yang lalu<br />
					Views: ${content['views']}<br />
					Comments: ${content['comments']}
				</p>
			</div>";
	}
	
	function renderLink($content) {
		$selisih = $content['waktu']['selisih'];
		$satuan = $content['waktu']['satuan'];
		return "<div id='artikelkonten'>
			<a href='konten.php?ID=${content['ID_konten']}'><strong>${content['judul']}</strong></a>
			<p>Dipost oleh <a href='profil.php?id=${content['ID_user']}'>${content['username']}</a> $selisih $satuan yang lalu<br />
				Views: ${content['views']}<br />
				Comments: ${content['comments']}
			</p>
			<p>${content['deskripsi']}</p>
		</div>";
	}

	function renderLike($like) {
		return "<div class='LikeContent'>
			<a onmouseover='' style='cursor: pointer;' onclick=\"return likeThis('like1');\" id='staty'>
				<img src='images/like.png' alt='post' name='gambarLike' />
			</a>
			<a onmouseover='' style='cursor: pointer;' onclick=\"return dislikeThis('like1');\">
				<img src='images/dislike.png' alt='post' />
			</a>
			<div class='likeCount'><a id='like1'>$like</a></div >
			<div><a id='statlike1'></a></div>
		</div>";
	}
?>